<template>
  <ul class="tab-bar">
   <router-link v-for='nav in navs' :key='nav.path' :to="nav.path" tag="li">
        <i class="iconfont" v-html="nav.meta.icon"></i>
        <span>{{nav.meta.title}}</span>
      </router-link>
  </ul>
</template>

<script>
import routes from '@/router/routes'
export default {
  name: 'TabBar',
  computed: {
    // 计算在tabbar中渲染的每一项
    navs() {
      // return routes.filter(route => route.meta?.inTabBar)
      return routes.filter(route => route.meta?.inTabBar)
    },
  },
}
</script>
<style lang="less" scoped>
.tab-bar{
  display: flex;
  height: 100px;
  border-top: 2px solid #f8c309;
  li{
    flex:1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-around;
    margin-top: 12px;

    i{
      font-size: 22px;
    }
    span{
      font-size: 12px;
    }
  }

  .router-link-exact-active,.router-link-active{
    color:#f8c309;
    font-style: 700;
  }
}
</style>
<style lang="less">

@font-face {
  font-family: 'iconfont';  /* Project id 3153747 */
  src: url('//at.alicdn.com/t/font_3153747_9rtijqjh207.woff2?t=1642668140649') format('woff2'),
       url('//at.alicdn.com/t/font_3153747_9rtijqjh207.woff?t=1642668140649') format('woff'),
       url('//at.alicdn.com/t/font_3153747_9rtijqjh207.ttf?t=1642668140649') format('truetype');
}
.iconfont{
    font-family:"iconfont" !important;
    font-size:16px;font-style:normal;
    -webkit-font-smoothing: antialiased;
    -webkit-text-stroke-width: 0.2px;
    -moz-osx-font-smoothing: grayscale;}
</style>
